package com.issc.framework.helper;

import com.issc.framework.ConfigConstant;
import com.issc.framework.util.PropertyUtil;

import java.util.Properties;

public class ConfigHelper {
    //加载属性文件
    private static final Properties CONFIG_PROPS = PropertyUtil.loadProps(ConfigConstant.CONFIG_FILE);

    //获取JDBC驱动
    public static String getJdbcDriver() {
        return PropertyUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_DRIVER, "null");
    }

    //获取JDBC URL
    public static String getJdbcUrl() {
        return PropertyUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_URL, "null");
    }

    //获取JDBC用户名
    public static String getUserName() {
        return PropertyUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_USERNAME, "null");
    }

    //获取JDBC密码
    public static String getPassWord() {
        return PropertyUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_PASSWORD, "null");
    }

    //获取应用基础包名
    public static String getAppBasePackage() {
        return PropertyUtil.getString(CONFIG_PROPS, ConfigConstant.APP_BASE_PACKAGE, "null");
    }

    //获取JSP路径
    public static String getAppJspPath() {
        return PropertyUtil.getString(CONFIG_PROPS, ConfigConstant.APP_JSP_PATH, "/WEB-INF/view/");
    }

    //获取静态资源路径
    public static String getAppAssetPath() {
        return PropertyUtil.getString(CONFIG_PROPS, ConfigConstant.APP_ASSET_PATH, "/static/");
    }

    public static int getAppUploadLimit() {
        return PropertyUtil.getInt(CONFIG_PROPS, ConfigConstant.APP_UPLOAD_LIMIT, 10);
    }
}
